const ObjectPoolFactory = (createObjFn) => {
    let objectPool = []; // 对象池

    return {
        create(...args) {
            let obj = objectPool.length === 0
                ? createObjFn(...args)
                : objectPool.shift();

            return obj;
        },
        recover(obj) {
            objectPool.push(obj); // 对象池回收对象
        }
    }
};
